//
//  HomeImageOrVitaminTableViewCell.m
//  110
//
//  Created by 沈鑫 on 16/4/8.
//  Copyright © 2016年 乔砥. All rights reserved.
//

#import "HomeImageOrVitaminTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation HomeImageOrVitaminTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        _commodityImageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, (KWIDTH - 40) / 2, 80)];
        [self.contentView addSubview:_commodityImageView1];
        _titleLabel1 = [[UILabel alloc]initWithFrame:CGRectMake(10, 95, (KWIDTH - 40) / 2, 20)];
        [self.contentView addSubview:_titleLabel1];
        
        _priceLabel1 = [[UILabel alloc]initWithFrame:CGRectMake(10, 130, 100, 20)];
        _priceLabel1.textColor = [UIColor redColor];
        [self.contentView addSubview:_priceLabel1];
        
        // =======================================
        _commodityImageView2 = [[UIImageView alloc]initWithFrame:CGRectMake(30 + (KWIDTH - 40) / 2, 10, (KWIDTH - 40) / 2, 80)];
        [self.contentView addSubview:_commodityImageView2];
        _titleLabel2 = [[UILabel alloc]initWithFrame:CGRectMake(30 + (KWIDTH - 40) / 2, 95, (KWIDTH - 40) / 2, 20)];
        [self.contentView addSubview:_titleLabel2];
        
        _priceLabel2 = [[UILabel alloc]initWithFrame:CGRectMake(30 + (KWIDTH - 40) / 2, 130, 100, 20)];
        _priceLabel2.textColor = [UIColor redColor];
        [self.contentView addSubview:_priceLabel2];
        
        UIView *lView = [[UIView alloc]initWithFrame:CGRectMake(20 + (KWIDTH - 40) / 2, 0, 0.5, 159)];
        lView.backgroundColor = [UIColor lightGrayColor];
        [self.contentView addSubview:lView];
        
        UIView *lViewSahang = [[UIView alloc]initWithFrame:CGRectMake(0, 1, KWIDTH, 0.5)];
        lViewSahang.backgroundColor = [UIColor lightGrayColor];
        [self.contentView addSubview:lViewSahang];
        
        UIView *lViewSahang1 = [[UIView alloc]initWithFrame:CGRectMake(0, 159, KWIDTH, 0.5)];
        lViewSahang1.backgroundColor = [UIColor lightGrayColor];
        [self.contentView addSubview:lViewSahang1];
    }
    return self;
}

- (void)getModel:(HomeImageModel *)model1 modle2:(HomeImageModel *)model2
{
    [_commodityImageView1 sd_setImageWithURL:[NSURL URLWithString:model1.TitleImg]];
    _titleLabel1.text = model1.NameCN;
    NSString *string1 = @"￥";
    [_priceLabel1.text stringByAppendingString:string1];
    _priceLabel1.text = [NSString stringWithFormat:@"%@ %@",string1,model1.AvgPrice];
    
    [_commodityImageView2 sd_setImageWithURL:[NSURL URLWithString:model2.TitleImg]];
    _titleLabel2.text = model2.NameCN;
    NSString *string2 = @"￥";
    [_priceLabel2.text stringByAppendingString:string2];
    _priceLabel2.text = [NSString stringWithFormat:@"%@ %@",string2,model2.AvgPrice];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
